home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 19
/
Mac Magazin and MacEasy Magazine CD - Issue 19.iso
/
Online
/
LineShare 3.3.1
/
LineShare Scripts
/
Motorola Fax1&ARA&Data
< prev
next >
Wrap
Text File
|
1995-05-22
|
7KB
|
368 lines
! Version 3.1.4
!
!$ Use this script with Motorola Power 28.8 modems
!$ Supports: fax class 1, ARA and regular data incoming calls.
^2 Speaker On: = Enum("Never" = "0","During Connect" = "1","Always"="2") "1"
^3 Speaker Volume: = Enum("Low"="1","Medium"="2","High"="3") "2"
^4 Answer On: = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
^5 Port Speed: = Enum("9600","19200","38400","57600") "38400"
^6 Handshake wires: = Bool("Both"="\Q3&D0","CTS only"="\Q2&D2") "\Q2&D2"
! ------------------------------------------
! Resetting the modem:
! ------------------------------------------
@Hangup
SetTries 2
Flush
HsReset 0,0,17,19,0,0
DtrSet
!
! Try to catch the "OK" answer, use the Escape seq and DTR transitions
! to enter the command mode
!
@Label 1
matchclr
matchstr 1 2 "OK\r\n"
write "AT&F\r"
matchread 20
ChrDelay 1
Write "+++"
ChrDelay 0
DtrClear
SBreak
DtrSet
!
DecTries
IfTries 0 1
!
! OSErr -6019 "Modem error - the modem is not responding"
!
exit -6019
@Label 2
write "AT+FCLASS=0\r"
Jsr 100
write "AT+FAA=0\r"
Jsr 100
exit 0
! ------------------------------------------
! Receiving incoming calls
! ------------------------------------------
@ANSWER
!
! Set the modem preferred speed first
!
SerReset 19200,0,8,1
Jsr 80
@Label 10
!
! Set the common options
Jsr 70
!
! Set the communication options:
! • - disabled: \N0: Normal connection (for ARA)
! • \V2: report connection speed
Write "AT\\V2\r"
Jsr 100
!
! Set Fax mode
!
Write "AT+FCLASS=0\r"
Jsr 100
Write "AT+FAA=1\r"
Jsr 100
!
! Tell the modem to determine the type of the incoming call
! Fetch the tube after ^4 rings
!
Write "ATS0=^4V0\r"
Jsr 110
!
! Everything is ready - let's sit and wait for a call
! We'll wait for 2 minutes, then reinitiate the modem
!
Note "Waiting for a fax/ARA/data call?"
MatchClr
MatchStr 1 15 "15\r"
MatchStr 2 14 "17\r"
matchstr 3 13 "2\r"
matchstr 4 57 "1\r"
matchstr 5 12 "3\r"
matchstr 6 12 "8\r"
matchstr 7 12 "7\r"
@Label 11
Matchread 1200
@Label 12
Note "Tuning again?"
Write "ATV1\r"
Jsr 100
Jump 10
@Label 13
Note "Ring?"
jump 11
@Label 14
Note "Fax tones detected?"
! IfStr 7 11 "V"
! SetSpeed 19200
Jump 11
@Label 15
Note "Data call?"
! SetSpeed Val("^5")
! ChrDelay 1
Write "ATV1O0\r"
! ChrDelay 0
MatchClr
MatchStr 1 16 "\r\nCONNECT ^$\r\n"
MatchRead 20
exit -6019
@Label 16
SetVar B "^$"
Jump 20
!
! Data connection has been established (we read "CONNECT")
! Put the "CONNECT" back to the buffer and attach the "Data" subPort
! if it was an incoming call, put the "RING" before the "CONNECT"
!
@Label 20
IfOpen "Data" 21
Jump 30
@Label 21
IfOpen "ARA" 22
Jump 35
@Label 22
Note "Waiting for an ARA frame"
MatchClr
MatchStr 1 23 "^$\r"
MatchStr 2 28 "\08\01\03\14\04\03\00\08\250\16\03"
MatchStr 3 29 "\01\27\02\29\01\02\01\06"
MatchRead 60
Jump 24
@Label 23
QueueInput "^$\r"
@Label 24
Note "Non-ARA call"
Jump 35
@Label 28
Note "ARA 1.0 call"
Jump 30
@Label 29
Note "ARA 2.0 call"
Jump 30
@Label 30
QueueInput "\r\nCARRIER ^B\r\n"
QueueInput "\r\nRING\r\n"
Attach "ARA" (DTR)
@Label 35
GetSReg C "DATA" 4
QueueInput "\r^CCONNECT ^B\r^C"
ifOriginate 36
QueueInput "\r^CRING\r^C"
@Label 36
Attach "Data" (DTR,Escape,Break)
! ------------------------------------------
! Originating a call through the "ARA" subport
! ------------------------------------------
@ORIGINATE "ARA"
SerReset Val("^5"),0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Data mode:
! • \N0:Normal connection (no compression, correction - for ARA)
! • S7: time-out (90 sec) for long-distance calls
! • \V2: report connection rate
!
Write "AT\\N0S7=90\\V2\r"
Jsr 100
!
! Emit the ARA script commands ("Xnn")
Jsr 60
!
! Prepare to receive all error result codes, dial the number
!
Jsr 90
MatchStr 1 55 "\r\nCONNECT ^$\r\n"
MatchRead 1000
Write "\r"
Exit -6019
@Label 55
QueueInput "\r\nCARRIER ^$\r\n"
Attach "ARA" (DTR)
! ------------------------------------------
! Originating a call through the "DATA" subport
! ------------------------------------------
@ORIGINATE "Data"
SerReset Val("^5"),0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Data mode:
! • \N7: Auto-reliable
! • S7: time-out (90 sec) for long-distance calls
! • \V0: report port speed
!
Write "AT\\N7S7=90\\V0\r"
Jsr 100
!
! Emit the Data commands
Jsr 60
!
! Prepare to receive all error result codes, dial the number
!
Jsr 90
MatchStr 1 56 "\r\nCONNECT "
MatchRead 1000
Write "\r"
Exit -6019
@Label 56
QueueInput "\r\nCONNECT "
Attach "Data" (DTR,Escape,Break)
! ------------------------------------------
! Originating a call through the "Fax" subPort
! ------------------------------------------
@ORIGINATE "Fax"
!
! Set the "Fax" speed
!
SerReset 19200,0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Fax mode
! \Q1: Xon/Xoff handshake
! &S0: DSR always on
!
Write "AT&S0\\Q1+FCLASS=1\r"
Jsr 100
!
! Now emit all commands that the application has sent to that port,
! except "FCLASS", etc
!
EmitClear "+FCLASS","V","E"
Jsr 60
Write "ATV0\r"
Jsr 110
!
! Prepare to receive all error result codes, dial the number
!
MatchClr
MatchStr 01 57 "1\r"
MatchStr 13 93 "3\r"
MatchStr 14 94 "8\r"
MatchStr 15 92 "7\r"
Write "ATD^1\r"
HsReset *
MatchRead 900
Write "\r"
Exit -6019
!
! Fax connection has been established (we read "FAX")
! Put the +FCON back to the buffer,
! if it was an incoming call, put the "RING" before the "+FCON"
! Attach the "Fax" subPort
!
@Label 57
QueueInput "1\r"
! IfStr 7 58 "V"
SetSpeed 19200
@Label 58
ifOriginate 59
QueueInput "2\r2\r"
@Label 59
Attach "Fax" (Reset(2400),IdleLimit=30)
!
! This section emits all modem commands sent from the client application
! For each set of commands the "OK" answer is awaited
!
@Label 60
EmitStart
@Label 61
EmitCommand 62
Jsr 100
Jump 61
@Label 62
return
!
! This section initiates the modem before ANSWER and ORIGINATEs:
! extended responses + connect at the highest rate + speaker control +
! reset on Dtr drop + DCD valid
! Verbal responses mode, no echo
!
@Label 70
Write "ATX4M^2L^3^6&C1V1E0\r"
Jsr 100
return
!
! This section syncronize the modem after the serial port speed switching
!
@Label 80
ChrDelay 1
Write "AT\r"
ChrDelay 0
Jsr 100
return
!
! Prepare to receive error result codes, send the dialing command and
! set the user's handshake mode
!
@Label 90
MatchClr
MatchStr 2 91 "NO DIALTONE\r\n"
MatchStr 3 92 "BUSY\r\n"
MatchStr 4 93 "NO CARRIER\r\n"
MatchStr 5 94 "NO ANSWER\r\n"
Write "ATD^1\r"
HsReset *
return
@Label 91
exit -6020
@Label 92
exit -6022
@Label 93
exit -6021
@Label 94
exit -6023
!
! Processing the AT command:
! OK -> proceed
! ERROR or TimeOut ->exit -6019
! It can be called AFTER the "Write" command, since LineShare buffers input
!
@Label 100
MatchClr
MatchStr 1 103 "\r\nOK\r\n"
MatchStr 2 102 "\r\nERROR\r\n"
@Label 101
MatchRead 20
@Label 102
Exit -6019
@Label 103
return
@Label 110
MatchClr
MatchStr 1 103 "0\r"
MatchStr 2 102 "4\r"
Jump 101